<h2 class="page_title">Disponibilités</h2>

<h3 class="sub_page_title dispoSelector">Sélectionnez une classe pour afficher une disponibilité ou <a href="#" class="class_all">visionner l'ensemble des disponibilités</a>.</h3>

<div class="dispoSelector">
	<ul>
		<li><a href="#" class="classe_1" title="Guerrier">Guerrier</a></li>
		<li><a href="#" class="classe_2" title="Paladin">Paladin</a></li>
		<li><a href="#" class="classe_3" title="Chasseur">Chasseur</a></li>
		<li><a href="#" class="classe_4" title="Voleur">Voleur</a></li>
		<li><a href="#" class="classe_5" title="Prêtre">Prêtre</a></li>
		<li><a href="#" class="classe_6" title="Chevalier de la Mort">Chevalier de la Mort</a></li>
		<li><a href="#" class="classe_7" title="Chaman">Chaman</a></li>
		<li><a href="#" class="classe_8" title="Mage">Mage</a></li>
		<li><a href="#" class="classe_9" title="Démoniste">Démoniste</a></li>
		<li><a href="#" class="classe_10" title="Moine">Moine</a></li>
		<li><a href="#" class="classe_11" title="Druide">Druide</a></li>
	</ul>
</div>

<div class="dispoContainer">
<?
foreach($data_classes as $id=>$data_classe){ ?>
	<div class='dispos_liste_classe' id='classe_<? echo $id; ?>'>
	<div class='dispos_liste_classe_title dispos_liste_classe_<? echo $id; ?>'><? echo $data_classe[0]; ?></div>
	<table style="width: 100%;" cellpadding="0">
		<tr>
			<td>&nbsp;</td>
			<td colspan="7">
				<table style=" width: 100%;" class="headerTable">
					<tr>
						<td style="width: 15px;"><? if($tso==$tsoa){ ?><img src="themes/Discovery/images/fleche_gauche2.gif" /><? }else{ ?><a href="<? echo CFG_REP_INSTALL."dispos"; ?>?tso=<? echo $tso-(7*24*3600); ?>#<? echo $id; ?>"><img src="themes/Discovery/images/fleche_gauche.gif" border="0" /></a><? } ?></td>
						<td class="week-title">Semaine du Mercredi <? echo date("d/m",$tso); ?> au Mardi <? echo date("d/m",$tso+(6*24*3600)); ?></td>
						<td style="width: 15px;"><a href="<? echo CFG_REP_INSTALL."dispos"; ?>?tso=<? echo $tso+(7*24*3600); ?>#<? echo $id; ?>"><img src="../WGM/themes/Discovery/images/fleche_droite.gif" border="0" /></a></td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<? for($i=0;$i<7;$i++){
				$m=date("m",$tso);
				$d=date("d",$tso);
				$y=date("y",$tso);
				$tso2=mktime(0,0,0,$m,$d+$i,$y); ?>
			<td class="week-day"><? echo $jours[date("w",$tso2)]."<br />".date("d/m",$tso2); ?></td>
			<? } ?>
		</tr>
	<? $res=$sql->request("select * from ".CFG_MYSQL_PREFIX."player where classe=".$id." order by nom");
	$j=0;
	foreach($res as $var){
		$player=new player($var); ?>
		<tr <? if(($j%2)==0){ ?>class="tr2"<? } ?>>
			<td>
				<table cellspacing="1" cellpadding="0" class="player-name">
					<tr>
						<td class="player-avatar"><img src="images/player/<? echo $player->get_race()."-".$player->get_sexe(); ?>.gif" alt="" /></td>
						<td style=""><a href="roster/player?id=<? echo $player->get_id(); ?>"><? echo $player->get_nom(); ?></a></td>
					</tr>
				</table>
			</td>
			<? for($i=0; $i<7; $i++){
				$m=date("m",$tso);
				$d=date("d",$tso);
				$y=date("y",$tso);
				$tso2=mktime(0,0,0,$m,$d+$i,$y);
				$dispo=get_dispo($tso2,$player->id);
				if($player->idUser==$GLOBALS["USER"]->id || user_droit("admin-configuration")){ ?>
			<td class="week-select-activity">
				<select onchange='disposChangeDispo(this,<? echo $player->id; ?>, <? echo $tso2; ?>);' style='background-color: <? echo $cfg_params["liste_types"][$dispo][1]; ?>;'>
					<? foreach($cfg_params["liste_types"] as $type){ ?>
					<option style='background-color: <? echo $type[1]; ?>' value='<? echo $type[2]; ?>' <? if($dispo==$type[2]) echo "selected='selected'"; ?>><? echo $type[0]; ?></option>
					<? } ?>
				</select>
			</td>
				<? }else{ ?>
			<td class="week-activity" style="background-color: <? echo $cfg_params["liste_types"][$dispo][1]; ?>;">&nbsp;</td>
				<? }
			}?>
		</tr>		
		<? $j++;
	}
	echo "</table></div>";
}

?>
</div>